package com.lhys.mapper;

import com.lhys.pojo.AssetBrand;
import com.lhys.pojo.AssetBrand;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 资产_品牌表 Mapper 接口
 * </p>
 *
 * @author 小七
 * @since 2021-05-06
 */
public interface AssetBrandMapper {
    //查询品牌列表
    @Select("select * from asset_brand")
    List<AssetBrand> getAssetBrandList();

    //根据名称或说明查询
    List<AssetBrand> getAssetBrandByCodeAndTitleOrRemarkList(AssetBrand assetBrand);

    //根据id查询
    @Select("select * from asset_brand where id = #{id}")
    AssetBrand getAssetBrandById(Integer id);

    //根据用户id查询
    @Select("select * from asset_brand where assetUserId = #{assetUserId}")
    AssetBrand getAssetBrandByAssetUserId(Integer assetUserId);

    //根据编码查询
    @Select("select * from asset_brand where code = #{code}")
    AssetBrand getAssetBrandByCode(String code);

    //新增品牌
    @Insert("insert into asset_brand(asset_user_id, title, code, status,remark, create_time) VALUES (#{assetUserId}, #{title}, #{code}, #{status}, #{remark}, #{createTime})")
    Integer addAssetBrand(AssetBrand AssetBrand);

    //删除品牌
    @Delete("delete from asset_brand where id = #{id}")
    Integer delAssetBrand(Integer id);

    //修改品牌
    Integer updateAssetBrand(AssetBrand assetBrand);

}
